window.cookie = function($window) {
    function getCookie(name) {
        var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
        if(arr = document.cookie.match(reg))
            return unescape(arr[2]);
        else
            return null;
    }
    return {
        //存储单个属性
        set: function(key, value) {
        	var values = JSON.stringify(value);
            var exp = new Date();
            exp.setTime(exp.getTime() + (0.5 * 60) * 60 * 1000);
//			exp.setTime(exp.getTime() + 900 * 1000);
            document.cookie = key + "=" + escape(values) + ";expires=" + exp.toGMTString();
        },
        del: function(key) {
            var exp = new Date();
            exp.setTime(exp.getTime() - 1);
        	var cval = getCookie(key)
            document.cookie = key + "=" + cval + ";expires=" + exp.toGMTString();
        },
        get:function(key) {
	        var arr, reg = new RegExp("(^| )" + key + "=([^;]*)(;|$)");
	        if(arr = document.cookie.match(reg))
	            return JSON.parse(unescape(arr[2]));
	        else
	            return {};
        },
        status:function(key) {
	        var arr, reg = new RegExp("(^| )" + key + "=([^;]*)(;|$)");
	        if(arr = document.cookie.match(reg))
	            return true;
	        else
	            return false;
        },
        delay:function(key) {
        	var cval = getCookie(key)
        	var values = cval;
            var exp = new Date();
            exp.setTime(exp.getTime() + (0.5 * 60) * 60 * 1000);
//			exp.setTime(exp.getTime() + 900 * 1000);
            document.cookie = key + "=" + escape(values) + ";expires=" + exp.toGMTString();
        }
    };

};